export function ConnectWebsocket(userId: string, callback: any) {
    let ws: WebSocket = new WebSocket(`ws://103.185.248.16:80/wsapi/ex/${userId}`);
    // let ws: WebSocket = new WebSocket(`ws://127.0.0.1:8080/ex/${userId}`);
    ws.onopen = () => {
        if (ws.readyState === WebSocket.OPEN) {
        }
    };
    ws.onerror = (event) => {
        console.log(event)
        callback('{"code": 1, "msg": "连接出错"}')
    };
    ws.onmessage = (event) => {
        console.log(event.data)

        callback(event.data)
    };
    ws.onclose = (event) => {

    };
    return ws;
}
